package com.lyy.entity.param;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Pattern;
import java.io.Serializable;

/** @author JoeZhou */
@Schema(name = "修改信息参数实体")
@Data
public class UserUpdateParam implements Serializable {

    @Schema(description = "用户姓名", required = true, example = "罗大娟")
    @Length(min = 2, max = 15, message = "用户姓名长度必须在2-15之间")
    private String realName;

    @Schema(description = "用户昵称", required = true, example = "赵英杰")
    @Length(min = 2, max = 15, message = "用户昵称长度必须在2-15之间")
    private String nickName;

    @Schema(description = "用户性别", required = true, example = "1")
    @Range(max = 2, message = "用户性别只能使用0，1，2三个值")
    private Integer gender;

    @Schema(description = "用户年龄", required = true, example = "35")
    @Range(min = 16, max = 60, message = "用户年龄必须在16-60之间")
    private Integer age;

    @Schema(description = "身份证号", required = true, example = "230107199306200211")
    @Pattern(regexp = "^\\d{17}[X|0-9]$", message = "身份证号格式不正确")
    private String idCard;

    @Schema(description = "手机号码", required = true, example = "18210210122")
    @Pattern(regexp = "^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\\d{8}$",
            message = "手机号码格式不正确")    
    private String phone;

    @Schema(description = "用户描述", required = true, example = "新描述")
    @Length(max = 1024, message = "用户描述长度必须在0-1024之间")
    private String userInfo;
}